<?
$ClientID = $_GET['ClientID'];

function getIDtype($idtype)
{

	$query="select identification_type from er_Identification_Type where identification_no='".$idtype."'";
	$resultIDtype = r_db($query);
	$row=mysql_fetch_array($resultIDtype);
	return $row;
}
?>
<h1>Edit Client</h1>
All required fields are marked with by the <img src="images/required.gif" alt="required field" /> icon.
<hr>
<!----verify if everything has been inputed---->
<SCRIPT language="JavaScript">

function removeCharacters( strValue, strMatchPattern ) {
/************************************************
DESCRIPTION: Removes characters from a source string
  based upon matches of the supplied pattern.

PARAMETERS:
  strValue - source string containing number.

RETURNS: String modified with characters
  matching search pattern removed

USAGE:  strNoSpaces = removeCharacters( ' sfdf  dfd',
                                '\s*')
*************************************************/
 var objRegExp =  new RegExp( strMatchPattern, 'gi' );

 //replace passed pattern matches with blanks
  return strValue.replace(objRegExp,'');
}

function DatePosition(dateString,value) {
	var now = new Date();
	var today = new Date(now.getYear(),now.getMonth(),now.getDate());
	var century = parseInt(now.getYear()/100)*100;
	var date = new Date(dateString.substring(6,10),
	dateString.substring(3,5)-1,
	dateString.substring(0,2));
	if(value == 1)
	{
		if (Date.parse(date) > Date.parse(today))
		{
			alert('Visit date must be less than or equal to todays date.');
			document.form.txtVisitDate.select();
			document.form.txtVisitDate.focus();
		}
	}
	if(value == 2)
	{
		if (Date.parse(date) >= Date.parse(today))
		{
			alert('Birth Date must be less than todays date.');
			document.form.txtDateOfBirth.select();
			document.form.txtDateOfBirth.focus();
		}
	}
	if(value == 3)
	{
		if (Date.parse(date) <= Date.parse(today))
		{
			alert('When Due date must be greater than or equal to todays date.');
			return -1;
		}
	}
}

function verify() {
	var themessage = "You are required to complete the following fields: \n";

	/*
	if (document.form.txtNumber.value=="") {
		themessage = themessage + " -  ID Reference Number\n";
	}
	*/
	if (document.form.txtSurname.value=="") {
		themessage = themessage + " - Surname\n";
	}
	if (document.form.txtGivenName.value=="") {
		themessage = themessage + " -  Given Name\n";
	}
	/*
	if (document.form.txtDob.value=="") {
		themessage = themessage + " - Date of Birth\n";
	}
	*/
	if (themessage == "You are required to complete the following fields: \n") {
		document.form.btnSaveForm.disabled=true;
		document.form.btnSaveForm.value='Please wait...';
		document.form.submit();

	}
	else {
		alert(themessage);
		return false;
	}
}

<!--check if the value is a number-->
function checknumber(pnum){
	var x=pnum.value
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(x))
	{
		testresult=true
	}
	else{
	alert("Please input a valid number!")
	testresult=false
}
return (testresult)
}

function checkban(pnum){
	if (document.layers||document.all||document.getElementById)
	return checknumber(pnum)
	else
	return true
}

function checknumberdollar(pnum){
	var x=pnum.value
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(x))
	{
		parseelement(pnum)
		testresult=true
	}
	else{
	alert("Please input a valid number!")
	testresult=false
}
return (testresult)
}

function checkbandollar(pnum){
	if (document.layers||document.all||document.getElementById)
	return checknumberdollar(pnum)
	else
	return true
}


<!--make the initial alphabet uppercase-->
function changeCase(frmObj) {
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	tmpStr = frmObj.value.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)  {
		for (index = 0; index < strLen; index++)  {
			if (index == 0)  {
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			}
			else {
				tmpChar = tmpStr.substring(index, index+1);
				if (tmpChar == " " && index < (strLen-1))  {
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
				}
			}
		}
	}
	frmObj.value = tmpStr;
}


<!--element focus-->

function putFocus(formInst, elementInst) {
	if (document.forms.length > 0) {
		document.forms[formInst].elements[elementInst].focus();
	}
}

<!-----------------------Validation OF Date---------------------------------------------------------->

var isNav4 = false, isNav5 = false, isIE4 = false
var strSeperator = "/";
// If you are using any Java validation on the back side you will want to use the / because
// Java date validations do not recognize the dash as a valid date separator.
var vDateType = 3; // Global value for type of date format
//                1 = mm/dd/yyyy
//                2 = yyyy/dd/mm  (Unable to do date check at this time)
//                3 = dd/mm/yyyy
var vYearType = 4; //Set to 2 or 4 for number of digits in the year for Netscape
var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating.
var err = 0; // Set the error code to a default of zero
if(navigator.appName == "Netscape") {
	if (navigator.appVersion < "5") {
		isNav4 = true;
		isNav5 = false;
	}
	else
	if (navigator.appVersion > "4") {
		isNav4 = false;
		isNav5 = true;
	}
}
else {
	isIE4 = true;
}


function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) {
	vDateType = dateType;
	// vDateName = object name
	// vDateValue = value in the field being checked
	// e = event
	// dateCheck
	// True  = Verify that the vDateValue is a valid date
	// False = Format values being entered into vDateValue only
	// vDateType
	// 1 = mm/dd/yyyy
	// 2 = yyyy/mm/dd
	// 3 = dd/mm/yyyy
	//Enter a tilde sign for the first number and you can check the variable information.
	if (vDateValue == "~") {
		alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator);
		vDateName.value = "";
		vDateName.focus();
		return true;
	}
	var whichCode = (window.Event) ? e.which : e.keyCode;
	// Check to see if a seperator is already present.
	// bypass the date if a seperator is present and the length greater than 8
	if (vDateValue.length > 8 && isNav4) {
		if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1))
		return true;
	}
	//Eliminate all the ASCII codes that are not valid
	var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";
	if (alphaCheck.indexOf(vDateValue) >= 1) {
		if (isNav4) {
			vDateName.value = "";
			vDateName.focus();
			vDateName.select();
			return false;
		}
		else {
			vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
			return false;
		}
	}
	if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
	return false;
	else {
		//Create numeric string values for 0123456789/
		//The codes provided include both keyboard and keypad values
		var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
		if (strCheck.indexOf(whichCode) != -1) {
			if (isNav4) {
				if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) {
					alert("Invalid Date\nPlease Re-Enter");
					vDateName.value = "";
					vDateName.focus();
					vDateName.select();
					return false;
				}
				if (vDateValue.length == 6 && dateCheck) {
					var mDay = vDateName.value.substr(2,2);
					var mMonth = vDateName.value.substr(0,2);
					var mYear = vDateName.value.substr(4,4)
					//Turn a two digit year into a 4 digit year
					if (mYear.length == 2 && vYearType == 4) {
						var mToday = new Date();
						//If the year is greater than 30 years from now use 19, otherwise use 20
						var checkYear = mToday.getFullYear() + 30;
						var mCheckYear = '20' + mYear;
						if (mCheckYear >= checkYear)
						mYear = '19' + mYear;
						else
						mYear = '20' + mYear;
					}
					var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
					if (!dateValid(vDateValueCheck)) {
						alert("Invalid Date\nPlease Re-Enter");
						vDateName.value = "";
						vDateName.focus();
						vDateName.select();
						return false;
					}
					return true;
				}
				else {
					// Reformat the date for validation and set date type to a 1
					if (vDateValue.length >= 8  && dateCheck) {
						if (vDateType == 1) // mmddyyyy
						{
							var mDay = vDateName.value.substr(2,2);
							var mMonth = vDateName.value.substr(0,2);
							var mYear = vDateName.value.substr(4,4)
							vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
						}
						if (vDateType == 2) // yyyymmdd
						{
							var mYear = vDateName.value.substr(0,4)
							var mMonth = vDateName.value.substr(4,2);
							var mDay = vDateName.value.substr(6,2);
							vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay;
						}
						if (vDateType == 3) // ddmmyyyy
						{
							var mMonth = vDateName.value.substr(2,2);
							var mDay = vDateName.value.substr(0,2);
							var mYear = vDateName.value.substr(4,4)
							vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
						}
						//Create a temporary variable for storing the DateType and change
						//the DateType to a 1 for validation.
						var vDateTypeTemp = vDateType;
						vDateType = 1;
						var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
						if (!dateValid(vDateValueCheck)) {
							alert("Invalid Date\nPlease Re-Enter");
							vDateType = vDateTypeTemp;
							vDateName.value = "";
							vDateName.focus();
							vDateName.select();
							return false;
						}
						vDateType = vDateTypeTemp;
						return true;
					}
					else {
						if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
							alert("Invalid Date\nPlease Re-Enter");
							vDateName.value = "";
							vDateName.focus();
							vDateName.select();
							return false;
						}
					}
				}
			}
			else {
				// Non isNav Check
				if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
					alert("Invalid Date\nPlease Re-Enter");
					vDateName.value = "";
					vDateName.focus();
					return true;
				}
				// Reformat date to format that can be validated. mm/dd/yyyy
				if (vDateValue.length >= 8 && dateCheck) {
					// Additional date formats can be entered here and parsed out to
					// a valid date format that the validation routine will recognize.
					if (vDateType == 1) // mm/dd/yyyy
					{
						var mMonth = vDateName.value.substr(0,2);
						var mDay = vDateName.value.substr(3,2);
						var mYear = vDateName.value.substr(6,4)
					}
					if (vDateType == 2) // yyyy/mm/dd
					{
						var mYear = vDateName.value.substr(0,4)
						var mMonth = vDateName.value.substr(5,2);
						var mDay = vDateName.value.substr(8,2);
					}
					if (vDateType == 3) // dd/mm/yyyy
					{
						var mDay = vDateName.value.substr(0,2);
						var mMonth = vDateName.value.substr(3,2);
						var mYear = vDateName.value.substr(6,4)
					}
					if (vYearLength == 4) {
						if (mYear.length < 4) {
							alert("Invalid Date\nPlease Re-Enter");
							vDateName.value = "";
							vDateName.focus();
							return true;
						}
					}
					// Create temp. variable for storing the current vDateType
					var vDateTypeTemp = vDateType;
					// Change vDateType to a 1 for standard date format for validation
					// Type will be changed back when validation is completed.
					vDateType = 1;
					// Store reformatted date to new variable for validation.
					var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
					if (mYear.length == 2 && vYearType == 4 && dateCheck) {
						//Turn a two digit year into a 4 digit year
						var mToday = new Date();
						//If the year is greater than 30 years from now use 19, otherwise use 20
						var checkYear = mToday.getFullYear() + 30;
						var mCheckYear = '20' + mYear;
						if (mCheckYear >= checkYear)
						mYear = '19' + mYear;
						else
						mYear = '20' + mYear;
						vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
						// Store the new value back to the field.  This function will
						// not work with date type of 2 since the year is entered first.
						if (vDateTypeTemp == 1) // mm/dd/yyyy
						vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
						if (vDateTypeTemp == 3) // dd/mm/yyyy
						vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
					}
					if (!dateValid(vDateValueCheck)) {
						alert("Invalid Date\nPlease Re-Enter");
						vDateType = vDateTypeTemp;
						vDateName.value = "";
						vDateName.focus();
						return true;
					}
					vDateType = vDateTypeTemp;
					return true;
				}
				else {
					if (vDateType == 1) {
						if (vDateValue.length == 2) {
							vDateName.value = vDateValue+strSeperator;
						}
						if (vDateValue.length == 5) {
							vDateName.value = vDateValue+strSeperator;
						}
					}
					if (vDateType == 2) {
						if (vDateValue.length == 4) {
							vDateName.value = vDateValue+strSeperator;
						}
						if (vDateValue.length == 7) {
							vDateName.value = vDateValue+strSeperator;
						}
					}
					if (vDateType == 3) {
						if (vDateValue.length == 2) {
							vDateName.value = vDateValue+strSeperator;
						}
						if (vDateValue.length == 5) {
							vDateName.value = vDateValue+strSeperator;
						}
					}
					return true;
				}
			}
			if (vDateValue.length == 10&& dateCheck) {
				if (!dateValid(vDateName)) {
					// Un-comment the next line of code for debugging the dateValid() function error messages
					//alert(err);
					alert("Invalid Date\nPlease Re-Enter");
					vDateName.focus();
					vDateName.select();
				}
			}
			return false;
		}
		else {
			// If the value is not in the string return the string minus the last
			// key entered.
			if (isNav4) {
				vDateName.value = "";
				vDateName.focus();
				vDateName.select();
				return false;
			}
			else
			{
				vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
				return false;
			}
		}
	}
}


function dateValid(objName) {
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var intday;
	var intMonth;
	var intYear;
	var booFound = false;
	var datefield = objName;
	var strSeparatorArray = new Array("-"," ","/",".");
	var intElementNr;
	// var err = 0;
	var strMonthArray = new Array(12);
	strMonthArray[0] = "Jan";
	strMonthArray[1] = "Feb";
	strMonthArray[2] = "Mar";
	strMonthArray[3] = "Apr";
	strMonthArray[4] = "May";
	strMonthArray[5] = "Jun";
	strMonthArray[6] = "Jul";
	strMonthArray[7] = "Aug";
	strMonthArray[8] = "Sep";
	strMonthArray[9] = "Oct";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dec";
	//strDate = datefield.value;
	strDate = objName;
	if (strDate.length < 1) {
		return true;
	}
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) {
				err = 1;
				return false;
			}
			else {
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
			}
			booFound = true;
		}
	}
	if (booFound == false) {
		if (strDate.length>5) {
			strDay = strDate.substr(0, 2);
			strMonth = strDate.substr(2, 2);
			strYear = strDate.substr(4);
		}
	}
	//Adjustment for short years entered
	if (strYear.length == 2) {
		strYear = '20' + strYear;
	}
	strTemp = strDay;
	strDay = strMonth;
	strMonth = strTemp;
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) {
		err = 2;
		return false;
	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) {
		for (i = 0;i<12;i++) {
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
				intMonth = i+1;
				strMonth = strMonthArray[i];
				i = 12;
			}
		}
		if (isNaN(intMonth)) {
			err = 3;
			return false;
		}
	}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) {
		err = 4;
		return false;
	}
	if (intMonth>12 || intMonth<1) {
		err = 5;
		return false;
	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
	}
	if (intMonth == 2) {
		if (intday < 1) {
			err = 8;
			return false;
		}
		if (LeapYear(intYear) == true) {
			if (intday > 29) {
				err = 9;
				return false;
			}
		}
		else {
			if (intday > 28) {
				err = 10;
				return false;
			}
		}
	}
	return true;
}


function LeapYear(intYear) {
	if (intYear % 100 == 0) {
		if (intYear % 400 == 0) { return true; }
	}
	else {
		if ((intYear % 4) == 0) { return true; }
	}
	return false;
}

<!------ to remove the white spaces------>
function remove_XS_whitespace(item)
{
	item.value = item.value.replace(/\r/g, " ");

	//There are regex switchs for printing /nonprinting characters
	//but they stripped some characters either needed or left some not wanted,
	//thats why the following replacement exists.
	item.value = item.value.replace(/[^ A-Za-z0-9`~!@#\$%\^&\*\(\)-_=\+\\\|\]\[\}\{'";:\?\/\.>,<]/g, "");

	//item.value = item.value.replace(/'/g, "");

	item.value = item.value.replace(/ +/g, " ");

	item.value = item.value.replace(/^\s/g, "");
	item.value = item.value.replace(/\s$/g, "");

	if (item.value == ' ') {
		item.value = ''
	}
}

function otheridtype(sel)
{
	option=document.form.cmbIdType.options[document.form.cmbIdType.selectedIndex].text;
	txt=option;
	if(txt == 'Other')
	{
		message='Enter Other ID type here';
		document.form.txtOtherIdType.value=message;
		document.form.txtOtherIdType.select();
		document.form.txtOtherIdType.focus();
	}
	else
	{
		document.form.txtOtherIdType.value="";
		document.form.cmbIdType.focus();
	}
}
</SCRIPT>
<?
$query = "SELECT * FROM er_Client WHERE client_id ='$ClientID'";
$query = r_db($query);
$row = mysql_fetch_array($query);
?>
<form name=form action="?page=submit_client_edit" method="post">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
  <td width="17%">
  	Surname:  <img src="images/required.gif" alt="required field" />
  	<input type="hidden" name="txtClientID" value="<? echo $ClientID; ?>">
  </td>
  <td width="32%"><input type="text" name="txtSurname" value="<? echo $row['surname']; ?>" size="20" maxlength="50" onblur="changeCase(this)" onchange="remove_XS_whitespace(this)" >
 
  </td>
  <td width="17%">GivenName:  <img src="images/required.gif" alt="required field" /></b></td>
  <td width="32%"><input type="text" value="<? echo $row['givenName']; ?>"  name="txtGivenName" size="20" maxlength="50" onblur="changeCase(this)" onchange="remove_XS_whitespace(this)"></b></font>
   
  </td>
</tr>
<?
$DOB =  $row[4];
//$DOB = date("Y-m-d",$DOB); //format the date in yyyy-mm-dd format eg 2000/09/08
$DbDOB=explode("-",$DOB);
$dayDOB=$DbDOB[2];
$monthDOB=$DbDOB[1];
$yearDOB=$DbDOB[0];
$DOB=$dayDOB."/".$monthDOB."/".$yearDOB;
//<td>$DOB</td>
?>
  <tr>
  	<td >Date Of Birth:</b></td>
    <td ><input 	type="text" 
					value="<? echo $DOB; ?>" 
					name="txtDob" 
					size='10' 
					maxlength="10">&nbsp;<img alt="Date Picker" onclick="new CalendarDateSelect( $(this).previous(), {year_range:150} );" src="./images/calendar.gif" style="border:0px; cursor:pointer;" />
					<br>DD/MM/YYYY or empty
    </td>
    
<?
/*    <td width="5%" >Nationality:  <img src="images/required.gif" alt="required field" /></td>
<?
$arrNationality = array("Albania","Algeria","American Samoa", "Andorra","Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
"Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia And Herzegovina", "Botswana", "Bouvet Island", "Brazil", "Brunei Darussalam",
"Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (keeling) Islands",
"Colombia", "Comoros", "Congo", "Cook Islands", "Costa Rica", "C�te D'ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador",
"Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Sthn Territories",
"Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Holy See", "Honduras", "Hong Kong",
"Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakstan", "Kenya", "Kiribati", "North Korea", "South Korea", "Kuwait", "Kyrgyzstan",
"Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta",
"Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova, Republic Of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
"Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan",
"Palau", "Palestinian Territory", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "R�union", "Romania", "Russian Federation", "Rwanda",
"Saint Helena", "Saint Kitts And Nevis", "Saint Lucia", "Saint Pierre And Miquelon", "Samoa", "San Marino", "Sao Tome And Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia",
"Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard And Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province Of China",
"Tajikistan", "Tanzania", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad And Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks And Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates",
"United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City State", "Venezuela", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis And Futuna", "Western Sahara", "Yemen",
"Yugoslavia", "Zaire", "Zambia", "Zimbabwe");

echo "<td><select size=\"1\" name=\"txtNationality\">";
foreach ($arrNationality as $valueNationality)
{
	if($row[5] == $valueNationality)
	{
		echo "<OPTION selected>$valueNationality</option>";
	}
	else
	{
		echo "<OPTION>$valueNationality</option>";
	}
}
echo "</select>";
?>
    
    </td>
  </tr>

<? 
*/
$M = '';
$F = '';
if ($row[6]=="M")
{
	$M = "CHECKED";
}
else
{
	$F = "CHECKED";
}
?>
<tr>
	<td>Gender</td>
  <td><input type="radio" value="Male" name="optGender" <? echo $M; ?>>Male<input type="radio" value="Female" name="optGender" <? echo $F; ?>>Female</td>
<?
/*
$arrLanguage = array("Albanian","Arabic","Bulgarian","Chinese","Croatian","Czech","Danish","Dutch",
"English","Fiji","Finnish","French","German","Greek","Hebrew","Hindi","Hungarian","Icelandic",
"Indonesian","Italian","Japanese","Korean","Norwegian Persian","Polish","Portuguese","Romanian",
"Russian","Serbian","Slovak","Slovenian","Spanish","Swedish","Thai","Turkish","Ukrainian",
"Vietnamese","Welsh","Other");
?>
<td>Preferred Language:&nbsp;</font></td>
<td><select size="1" name="txtPreferredLanguage">
<?
foreach ($arrLanguage as $valueLanguage)
{
	if($row[7] == $valueLanguage)
	{
		echo "<OPTION selected>$valueLanguage</option>";
	}
	else
	{
		echo "<OPTION>$valueLanguage</option>";
	}
}
?>
</select></font></td>
</tr>

<?
*/

$idtyperesult=getIDtype($row[10]);
?>

<tr>
<td>ID Type</td>
<td><select name="cmbIdType" onchange="otheridtype(this)">
<?
populateSelectedDropDownListBoxes("er_Identification_Type",1,$idtyperesult[0],"identification_type");
?>
</select>
</td>
<?
generateTextBox("Other ID type:","text","txtOtherIdType", $row[8]);
?>
<tr>
<td>ID Reference No.
<td><input type="textbox" name="txtNumber" onblur="this.value=(removeCharacters(this.value,'[^a-zA-Z0-9]'));" value="<? echo $row[1]; ?>"></td>
</tr>
<tr>
	<td>
		<input type="button" value="Delete" onclick="if (txtClientID.value > 0 && confirm('Are you sure you want to delete the current client including all visits?')) {Delete.value=1; submit();}">
		<input type="hidden" name="Delete" value="0">
	</td>
	<td>&nbsp;
		
	</td>
	<td>&nbsp;
		
	</td>
	<Td>
		<input type="button" value="Update Changes" onclick="verify();" name="btnSaveForm">
	</td>
</tr>
</table>
</form>